#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
unsigned u, v;
bool dfs(unsigned x) {
  if(x>v)return false;
  if(x==v)return true;
  for(int i=(x&-x); i<=x; i<<=1) {
    if((i&x)==i) {
      if(i==v) {
        return true;
      }
      else {
        if(dfs(i+x))return true;
      }
    }
    else continue;
  }
  return false;
}
void solve() {
  if(u>v){cout<<"NO\n";return;}
  else if(u==v){cout<<"YES\n";return;}
  if(dfs(u))cout<<"YES\n";
  else cout<<"NO\n";
}
int main() {
  // freopen("in.txt", "r", stdin);
  int tc; cin>>tc;
  while(tc--) {
    cin>>u>>v;
    solve();
  }
}